<?php
 
    function Sanpham()
    {
           $sql="SELECT * FROM sanpham";
           $kq=  mysql_query($sql);
           return $kq;
           
    }
    function ChitietSP()
    {
        if(isset($_GET['idSP']))
          $idSP=$_GET['idSP'];
          $sql = "SELECT * FROM sanpham WHERE idSP=$idSP ";
          $kq = mysql_query($sql);
        return $kq;
    }
    function Chitiet_SP($idSP)
    {
        $sql="SELECT * FROM sanpham WHERE idSP=$idSP";
        $kq = mysql_query($sql);
        return $kq;
    }
    function ChitietThuocTinh($idSP)
    {
        $sql = "SELECT * FROM sanpham_thuoctinh WHERE idSP = $idSP";
        $kq = mysql_query($sql);
        return $kq;
    }
    function SanphamMoi($Limit,$new)
    {
        $sql = "SELECT * FROM sanpham WHERE New=$new order by idSP DESC limit 0,$Limit ";
        $kq = mysql_query($sql);
        return $kq;
    }
    function SanphamCC($Limit,$Gia1,$Gia2)
    {
        $sql = "SELECT * FROM sanpham WHERE Gia BETWEEN $Gia1 AND $Gia2 order by idSP DESC limit 0,$Limit ";
        $kq = mysql_query($sql);
        return $kq;
    }
    function SanphamTC($Limit,$Gia1,$Gia2)
    {
        $sql = "SELECT * FROM sanpham WHERE Gia BETWEEN $Gia1 AND $Gia2 order by idSP DESC limit 0,$Limit ";
        $kq = mysql_query($sql);
        return $kq;
    }
    function SanphamPT($Limit,$Gia1)
    {
        $sql = "SELECT * FROM sanpham WHERE Gia BETWEEN 0 AND $Gia1 order by idSP DESC limit 0,$Limit ";
        $kq = mysql_query($sql);
        return $kq;
    }
?>
